<?php
namespace Admin\Model;
use Think\Model;

/**
 * 站点设置模块
 * @author 
 *        
 */
class SettingModel extends Model
{
    /**
     * 
     * @param string $data
     * @return boolean
     */
    public function setting_update($data="") {
        
        $data['sitename'] = isset($data['sitename']) ? strip_tags($data['sitename']) : '';
        $data['title'] = isset($data['title']) ? strip_tags($data['title']) : '';
        $data['keywords'] = isset($data['keywords']) ? strip_tags($data['keywords']) : '';
        $data['description'] = isset($data['description']) ? strip_tags($data['description']) : '';
        $data['footer'] = isset($data['footer']) ? $data['footer'] : '';
        $Model = M('setting');
        foreach ($data as $k => $v) {
            $Model->data(array('v' => $v))->where("k='{$k}'")->save();
        }
        //清除旧的缓存数据
        $cache = \Think\Cache::getInstance();
        $cache->clear();
        addlog('修改网站配置。');
        return true;
    }
}

?>